#ifndef __myvari__
#define __myvari__

// 舵机角度，A是正向顺时针，R是反向逆时针
#define SERVO_0_A 120  // 原为：102
#define SERVO_45_A 187
#define SERVO_90_A 315   // 280
#define SERVO_135_A 443  // 373
#define SERVO_180_A 510

#define SERVO_0_R 510
#define SERVO_45_R 443
#define SERVO_90_R 315
#define SERVO_135_R 187
#define SERVO_180_R 120

// 分钟和小时
uint8_t minu = 0;
uint8_t hour = 0;
uint8_t seco = 0;

uint8_t minu_0 = 0;
uint8_t minu_1 = 0;
uint8_t hour_0 = 0;
uint8_t hour_1 = 0;
uint8_t seco_0 = 0;

// 显示的数字char码
uint8_t num0 = 0;  // 48-57:char('0'-'9')
uint8_t num1 = 0;  // 48-57:char('0'-'9')
uint8_t num2 = 0;  // 48-57:char('0'-'9')
uint8_t num3 = 0;  // 48-57:char('0'-'9')

uint8_t set = 0;  // 数字位0-4，是否进入设置状态

// 字段对应通道
/*     1
      ----
   0 |    | 2
     | 6  |
      ----
   5 |    | 3
     | 4  |
      ----
*/
// 7个字段编号，共4个数字需要显示
#define SEG_0_0 0
#define SEG_0_1 1 
#define SEG_0_2 2 
#define SEG_0_3 3 
#define SEG_0_4 4 
#define SEG_0_5 5 
#define SEG_0_6 6 
#define SEG_0_R 7 

#define SEG_1_0 0 + 8
#define SEG_1_1 1 + 8
#define SEG_1_2 2 + 8
#define SEG_1_3 3 + 8
#define SEG_1_4 4 + 8
#define SEG_1_5 5 + 8
#define SEG_1_6 6 + 8
#define SEG_1_R 7 + 8

#define SEG_2_0 0
#define SEG_2_1 1
#define SEG_2_2 2
#define SEG_2_3 3
#define SEG_2_4 4
#define SEG_2_5 5
#define SEG_2_6 6
#define SEG_2_R 7

#define SEG_3_0 0 + 8
#define SEG_3_1 1 + 8
#define SEG_3_2 2 + 8
#define SEG_3_3 3 + 8
#define SEG_3_4 4 + 8
#define SEG_3_5 5 + 8
#define SEG_3_6 6 + 8
#define SEG_3_R 7 + 8

// 字段的偏移量，因为装配问题，字段不一定平整，需要调整一下
uint8_t OFFSET_MAX = 160;
uint8_t OFFSET_MIN = 40;

uint8_t SET_DEFAULT;

uint8_t OFFSET_UP_0_0;
uint8_t OFFSET_UP_0_1;
uint8_t OFFSET_UP_0_2;
uint8_t OFFSET_UP_0_3;
uint8_t OFFSET_UP_0_4;
uint8_t OFFSET_UP_0_5;
uint8_t OFFSET_UP_0_6;

uint8_t OFFSET_UP_1_0;
uint8_t OFFSET_UP_1_1;
uint8_t OFFSET_UP_1_2;
uint8_t OFFSET_UP_1_3;
uint8_t OFFSET_UP_1_4;
uint8_t OFFSET_UP_1_5;
uint8_t OFFSET_UP_1_6;

uint8_t OFFSET_UP_2_0;
uint8_t OFFSET_UP_2_1;
uint8_t OFFSET_UP_2_2;
uint8_t OFFSET_UP_2_3;
uint8_t OFFSET_UP_2_4;
uint8_t OFFSET_UP_2_5;
uint8_t OFFSET_UP_2_6;

uint8_t OFFSET_UP_3_0;
uint8_t OFFSET_UP_3_1;
uint8_t OFFSET_UP_3_2;
uint8_t OFFSET_UP_3_3;
uint8_t OFFSET_UP_3_4;
uint8_t OFFSET_UP_3_5;
uint8_t OFFSET_UP_3_6;

// 字段356是否向上，因为6动作时，3和5必须先让一下
bool seg03up = false;
bool seg05up = false;
bool seg06up = false;

bool seg13up = false;
bool seg15up = false;
bool seg16up = false;

bool seg23up = false;
bool seg25up = false;
bool seg26up = false;

bool seg33up = false;
bool seg35up = false;
bool seg36up = false;

#endif